/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cxt.Util;

import java.util.GregorianCalendar;
import java.util.Random;

/**
 *
 * @author jgutierrez
 */
public class Funciones {
    
    public static String generarCadenaAlfanumerica(int longitud) {
        String cadena ="";
        
        long milis = new GregorianCalendar().getTimeInMillis();
        Random r = new Random(milis);
        
        int i = 0;
        
        while ( i< longitud){
            char c = (char)r.nextInt(255);
            if( (c>='0' && c<=9) || (c>='A' && c<='Z') ) {
                cadena += c;
                i++;
            }
        }
        
        return cadena;
    }
}
